package com.person.leetcode.editor.cn;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;

/**
  * 448.找到所有数组中消失的数字
  * 2022-10-08 17:11:02
**/
public class Sequence_0448_FindAllNumbersDisappearedInAnArray {
    public static void main(String[] args) {
        Solution solution = new Sequence_0448_FindAllNumbersDisappearedInAnArray().new Solution();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
class Solution {
    public List<Integer> findDisappearedNumbers(int[] nums) {
        HashMap<Integer, Object> map = new HashMap<>();
        ArrayList<Integer> ans = new ArrayList<>();

        for (int i = 0; i < nums.length; i++) {
            map.put(nums[i], null);
        }
        for (int i = 1; i <= nums.length; i++) {
            if (!map.containsKey(i)){
                ans.add(i);
            }
        }
        return  ans;
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}